<?php Session::init(); ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8"></meta>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
	<title>Lib tool where we go</title>
	
	<link rel="stylesheet" href="<?php echo URL ;?>Public/css/style.css" ></link>
	<link rel="stylesheet" href="<?php echo URL ;?>Public/css/font-awesome.css" ></link>
	<link rel="stylesheet" href="<?php echo URL ;?>Public/css/imgareaselect-default.css" ></link>
	
	<script type="text/javascript" src="<?php echo URL ;?>Public/js/jquery-1.11.1.min.js" ></script>
	<script type="text/javascript" src="<?php echo URL ;?>Public/js/js_lib.js" ></script>
	<script type="text/javascript" src="<?php echo URL ;?>Public/js/angular.min.js" ></script>
	<script type="text/javascript" src="<?php echo URL ;?>Public/js/jquery.imgareaselect.min.js"></script>
	<script type="text/javascript">
			function hostReachable() {
 
				// Handle IE and more capable browsers
				var xhr = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" );
				var status;
				var server = window.location.hostname;
				if (window.location.port != '') {
					server += ':'+window.location.port;
				}
				// Open new request as a HEAD to the root hostname with a random param to bust the cache
				xhr.open( "HEAD", "<?php echo URL;?>UploadImg", false );
				// Issue request and handle response
				try {
					xhr.send();
					console.log(xhr);
					return ( xhr.status >= 200 && xhr.status < 300 || xhr.status === 304 );
				} catch (error) {
					return false;
				}
			}
			$(document).ready(function() {
				getLocation();
				console.log(hostReachable());
			});
		</script>
</head>
<body>
	<div id="container">
		<div id="header" >
			<div class="toolbar wp"> 
				<div class="wp item_tool _item"><form name="photo" enctype="multipart/form-data" action="<?php echo URL;?>UploadImg/upload_img" method="post">
	Photo <input type="file" name="image" size="30" /> <input type="submit" name="upload" value="Upload" />
	</form></div>
				<div class="wp item_tool _item"><a href="<?php echo URL; ?>UserProfile"><?php if(session::get('loggerIn') == true) { echo $this->f->the_excerpt($_SESSION["FirstName"],8);} ?></a></div>
				<div class="wp item_tool _item"><a href="<?php echo URL; ?>News"><i class="fa fa-newspaper-o"></i>News</a></div>
				<div class="wp item_tool _item"><a href="<?php echo URL; ?>Places/NewPlace"><i class="fa fa-plus-square"></i>New wifi</a></div>
			<?php if(session::get('loggerIn') == true): ?>

				<div class="wp item_tool _item"><div class="icon primary_picture" style="background-image:  url('<?php echo $_SESSION['img_icon']; ?>') " ></div></div>
				<div class="login wp item_tool ">
					<div class="arro"></div>
					<div class="arro-2"></div>
					<div class="box profile">
						<div class="user-profile">
							<a><img  src="<?php echo $_SESSION['img_normal']; ?>" /></a>
							<div class="user">
								<div><b><?php echo $_SESSION["FirstName"]; ?></b></div>
								<div><?php echo $_SESSION["email"]; ?></div>
							</div><!--End div user-->
							<div class="clear"></div>
						</div><!--End div user-profile-->
						<div class="footer-profile">
							<a href="<?php echo URL ;?>Login/logout">  Logout</a>
						</div><!--End div footer-profile-->
					</div><!--End div box profile-->
				</div>
			<?php else :?>
				<div class="login wp item_tool ">
					<a href="<?php echo URL ;?>Login" class="btn tool_login"> Login </a>
				</div>
			<?php endif;?>
			<div class="clear"></div>
			</div><!--End toolbar wp Sit-->
			<?php if(!isset($this->_index)): ?>
			<div class="search_header wp">
				<form action="<?php echo URL; ?>SearchPlace/search_by_key" method="post" class="frm_search wp">
					<div class="search_header wp">
						<div class="header-logo wp" >
							<a href="<?php echo URL; ?>"><img src="<?php echo URL; ?>Public/img/logo/141x48.png" alt="Shaphira"/></a>
						</div>
						<div class="input_text_search wp"> 
							 <div class="input_search_place wp">
								<input type="text" autocomplete="off" name="search_place" value="<?php if(isset($_POST['search_place'])) { echo $_POST['search_place']; } ?>" placeholder="Search place name,steet, city, location and more" class="search_place" />
							</div>
 							<a href="#" class="submit_form"><div class="btn_search wp" ><i class="fa fa-search "></i></div></a>
							<script type="text/javascript">
								$(document).ready(function() {
									$('.search_place').focus(function () {
										$('.input_search_place').addClass('bdat');
									}).focusout(function () {
										$('.input_search_place').removeClass('bdat');
									});
									$(".submit_form").click(function (){
										var _value = $(".search_place").val().length;
										if( _value > 0) {
											$(".frm_search").submit();
										}
										return false;
									});
								});
							</script>
						</div>
					</div>
				</form>
			</div>
			 <?php endif; ?> 


			<div class="clear"></div>
		</div><!-- end header-->
		
